/**
 * user-actor
 * @authors 杨兴洲（of2502）
 * @date    2017/5/22 0022 18:38
 * @version 1.0
 * @last-modify  杨兴洲（of2502）
 */

import {Map} from 'immutable'
import {Action, Actor} from 'iflux2';
import * as types from '../constants/actionTypes'
export default class UserActor extends Actor {
    defaultState() {
        return {
            userInfo: Map(),
            authUrl: ""
        }
    }

    /**
     * 获取用户信息
     * @param {*} state
     * @param {*} userInfo
     */
    @Action(types.FETCH_USER_INFO)
    fetchUserInfo(state, userInfo) {
        return state.set('userInfo', userInfo);
    }

    /**
     * 获取授权链接地址
     * @param {*} state
     * @param {*} authUrl
     */
    @Action(types.FETCH_AUTH_URL)
    fetchAuthUrl(state, authUrl) {
        return state.set('authUrl', authUrl);
    }

    /**
     * 绑定用户信息
     * @param {*} state
     * @param {*} authUrl
     */
    @Action(types.BIND_ACCOUNT)
    bindAccount(state, authUrl) {
        // return state.set('authUrl', authUrl);
    }

    /**
     *
     */
    @Action(types.SHOW_BIND_MODAL)
    showBindModal(state, authUrl) {
        // alert("1")
    }


}